package com.hw.one.dam2.util;

import java.util.Comparator;
import java.util.Map;

/**
 * 比较 mongo 中读取的 空气质量数据
 * 
 * @author alicke
 *
 */
@SuppressWarnings("rawtypes")
public class AQIComparatorMap implements Comparator<Map> {

	@Override
	public int compare(Map map01, Map map02) {
		
		Object aqiObj01 = map01.get("AQI");
		aqiObj01 = null==aqiObj01 || "".equals(aqiObj01) ? "0" : aqiObj01;
		Object aqiObj02 = map02.get("AQI");
		aqiObj02 = null==aqiObj02 || "".equals(aqiObj02) ? "0" : aqiObj02;
		
		return Integer.valueOf(aqiObj02.toString()).compareTo(Integer.valueOf(aqiObj01.toString()));
	}

}
